#![allow(dead_code)]

enum Status {
    Rich,
    Poor,
}

enum Work {
    Civilian,
    Soldier,
}

fn explicitly_use() {
    // Explicitly `use` each name so they are available without manual scoping.
    use crate::Status::{Poor, Rich};
    // Automatically `use` each name inside `Work`.
    use crate::Work::*;

    // Equivalent to `Status::Poor`.
    let status = Poor;

    // Equivalent to `Work::Civilian`.
    let work = Civilian;

    match status {
        // Note the lack of scoping because of the explicit `use` above.
        Poor => println!("I am poor."),
        Rich => println!("I am rich."),
    }

    match work {
        // Note the lack of scoping because of the explicit `use` above.
        Civilian => println!("I am a civilian."),
        Soldier => println!("I am a soldier."),
    }
}

fn implicitly_use() {
    // Equivalent to `Status::Poor`.
    let status = Status::Poor;

    // Equivalent to `Work::Civilian`.
    let work = Work::Civilian;

    match status {
        // Note the lack of scoping because of the explicit `use` above.
        Status::Poor => println!("I am poor."),
        Status::Rich => println!("I am rich."),
    }

    match work {
        // Note the lack of scoping because of the explicit `use` above.
        Work::Civilian => println!("I am a civilian."),
        Work::Soldier => println!("I am a soldier."),
    }
}

fn main() {
    explicitly_use();
    implicitly_use();
}